package com.dianxin.smartpark.web.park;

import java.util.List;

import cn.dev33.satoken.annotation.SaCheckPermission;
import com.chinatelecom.response.common.CommonResponseBody;
import com.dianxin.smartpark.dao.qo.park.SmartParkCarParkPlaceQO;
import com.dianxin.smartpark.service.park.SmartParkCarParkPlaceService;
import com.dianxin.smartpark.service.vo.park.SmartParkCarParkPlaceVO;
import com.dianxin.sso.client.annotation.RecordLog;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 停车位
 * 
 * @author chenjiasong
 * @date 2021-07-28
 */
@RestController
@RequestMapping("/smartpark/place")
public class SmartParkCarParkPlaceController
{
    @Resource
    private SmartParkCarParkPlaceService smartParkCarParkPlaceService;

    /**
     * 查询停车位列表
     */
    @GetMapping("/list")
    @SaCheckPermission(value = "/smartpark/place/list")
    public CommonResponseBody<List<SmartParkCarParkPlaceVO>>  list(SmartParkCarParkPlaceQO qo)
    {
        return smartParkCarParkPlaceService.selectSmartParkCarParkPlaceList(qo);
    }


    /**
     * 获取停车位详细信息
     */
    @GetMapping(value = "/getInfo")
    @SaCheckPermission(value = "/smartpark/place/getInfo")
    public CommonResponseBody<SmartParkCarParkPlaceVO> getInfo(SmartParkCarParkPlaceQO qo)
    {
        return smartParkCarParkPlaceService.selectSmartParkCarParkPlace(qo);
    }

    /**
     * 新增停车位
     */
    @PostMapping("/add")
    @SaCheckPermission(value = "/smartpark/place/add")
    @RecordLog(name = "新增停车位")
    public  CommonResponseBody<Boolean> add(@RequestBody SmartParkCarParkPlaceVO vo)
    {
        return smartParkCarParkPlaceService.insertSmartParkCarParkPlace(vo);
    }

    /**
     * 修改停车位
     */
    @PutMapping("/edit")
    @SaCheckPermission(value = "/smartpark/place/edit")
    @RecordLog(name = "修改停车位")
    public  CommonResponseBody<Boolean> edit(@RequestBody SmartParkCarParkPlaceVO vo)
    {
        return smartParkCarParkPlaceService.updateSmartParkCarParkPlace(vo);
    }

    /**
     * 删除停车位
     */
	@DeleteMapping("/remove")
    @SaCheckPermission(value = "/smartpark/place/remove")
    @RecordLog(name = "删除停车位")
    public  CommonResponseBody<Boolean> remove(@RequestBody SmartParkCarParkPlaceVO vo)
    {
        return smartParkCarParkPlaceService.deleteSmartParkCarParkPlace(vo);
    }
}
